package com.example.api.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description API版本配置参数自动配置
 * @Author jie.zhao
 * @Date 2021/9/10 15:10
 */
@Configuration
@EnableConfigurationProperties(ApiVersionConfigProperties.class)
public class ApiVersionAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public ApiVersionWebMvcRegistrations apiVersionWebMvcRegistrations(ApiVersionConfigProperties apiVersionConfigProperties) {
        return new ApiVersionWebMvcRegistrations(apiVersionConfigProperties);
    }
}
